 <div class="container">
 <%= if @conn.assigns[:user] do %>
  <h1>Recent Posts</h1>
  <%= for post <- @posts do %>

    <div class="row">
    <div class="col s12">
      <div class="card">
        <div class="card-content">
          <span class="card-title"><%= post.title %></span>
          <p><%= post.body %></p>
        </div>
        <div class="card-action">
          <a href="#">By: <%= Blogger.Repo.get(Blogger.User, post.user_id).name %></a>
        </div>
      </div>
    </div>
  </div>

  <% end %>
  <% else %>
  <div class="text-center">
  
 <h2 class="grey-text">Please, login into your account</h2>
      <div class="section"></div>

      <div class="container">
        <div class="z-depth-1 grey lighten-4 row" style="display: inline-block; padding: 32px 48px 0px 48px; border: 1px solid #EEE;">

          <%= form_for @changeset, auth_path(@conn, :login), fn f -> %>
            <div class='row'>
              <div class='col s12'>
              </div>
            </div>

            <div class='row'>
              <div class='input-field col s12'>
                <%= text_input f, :email, class: "validate", type: "email", id: "email", placeholder: "Enter your email" %>
              </div>
            </div>

            <div class='row'>
              <div class='input-field col s12'>
              <%= text_input f, :password, class: "validate", type: "password", id: "password", placeholder: "Enter your password" %>
              </div>
            </div>

            <br />
              <div class='row'>
                <%= submit "Login", class: "col s12 btn btn-large waves-effect indigo-lighten" %>
                &nbsp;
                <br>
                <%= link to: auth_path(@conn, :signup), class: "" do %>Don't have an account? Signup<% end %>
              </div>
          <% end %>
        </div>
      </div>
      
        
  </div>
      <% end %>
      </div>
